home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Sample Code / Development Tools & Languages / AppsToGo / DTS.Lib / TUndoPartObj.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  2.9 KB  |  117 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** Program:     DTS.Lib
  5. ** File:        TUndoPartObj.c
  6. ** Written by:  Eric Soldan
  7. **
  8. ** Copyright © 1992 Apple Computer, Inc.
  9. ** All rights reserved.
  10. */
  11.  
  12. /* You may incorporate this sample code into your applications without
  13. ** restriction, though the sample code has been provided "AS IS" and the
  14. ** responsibility for its operation is 100% yours.  However, what you are
  15. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  16. ** after having made changes. If you're going to re-distribute the source,
  17. ** we require that you make it clear in the source that the code was
  18. ** descended from Apple Sample Code, but that you've made changes. */
  19.  
  20. #ifndef __OSEVENTS__
  21. #include <OSEvents.h>
  22. #endif
  23.  
  24. #ifndef __OSUTILS__
  25. #include <OSUtils.h>
  26. #endif
  27.  
  28. #ifndef __QUICKDRAW__
  29. #include <Quickdraw.h>
  30. #endif
  31.  
  32. #ifndef __TREEOBJ__
  33. #include "TreeObj.h"
  34. #endif
  35.  
  36. #ifndef __UTILITIES__
  37. #include "Utilities.h"
  38. #endif
  39.  
  40.  
  41.  
  42. /**********************************************************************/
  43. /**********************************************************************/
  44.  
  45. #ifdef applec
  46. #pragma segment ATGTreeObj
  47. #endif
  48.  
  49. /**********************************************************************/
  50. /**********************************************************************/
  51.  
  52.  
  53.  
  54. long    TUndoPartObj(TreeObjHndl hndl, short message, long data)
  55. {
  56.     short    fileRefNum;
  57.     char    *cptr;
  58.  
  59.     switch (message) {
  60.         case CONVERTMESSAGE:
  61.             switch (data) {
  62.                 case CONVERTTOID:
  63.                     Hndl2ID(&mDerefUndoPart(hndl)->shndl);
  64.                     Hndl2ID(&mDerefUndoPart(hndl)->dhndl);
  65.                     break;
  66.                 case CONVERTTOHNDL:
  67.                     ID2Hndl(hndl, &mDerefUndoPart(hndl)->shndl);
  68.                     ID2Hndl(hndl, &mDerefUndoPart(hndl)->dhndl);
  69.                     break;
  70.             }
  71.             break;
  72.  
  73.         case FREADMESSAGE:
  74.             fileRefNum = data;
  75.             return(ReadTreeObjData(hndl, fileRefNum));
  76.             break;
  77.  
  78.         case FWRITEMESSAGE:
  79.             fileRefNum = data;
  80.             return(WriteTreeObjData(hndl, fileRefNum));
  81.             break;
  82.  
  83.         case VHMESSAGE:
  84.             cptr = ((VHFormatDataPtr)data)->data;
  85.             ccatchr   (cptr, 13, 2);
  86.             ccat      (cptr, "$10: TUndoPartObj:");
  87.             ccatchr   (cptr, 13, 1);
  88.             ccat      (cptr, "  $00: actionType = ");
  89.             ccatdec   (cptr, mDerefUndoPart(hndl)->actionType);
  90.             ccatchr   (cptr, 13, 1);
  91.             ccat      (cptr, "  $02: shndl      = $");
  92.             ccatpadhex(cptr, '0', 8, 8, (long)mDerefUndoPart(hndl)->shndl);
  93.             ccatchr   (cptr, 13, 1);
  94.             ccat      (cptr, "  $06: scnum      = ");
  95.             ccatdec   (cptr, mDerefUndoPart(hndl)->scnum);
  96.             ccatchr   (cptr, 13, 1);
  97.             ccat      (cptr, "  $08: dhndl      = $");
  98.             ccatpadhex(cptr, '0', 8, 8, (long)mDerefUndoPart(hndl)->dhndl);
  99.             ccatchr   (cptr, 13, 1);
  100.             ccat      (cptr, "  $0C: dcnum      = ");
  101.             ccatdec   (cptr, mDerefUndoPart(hndl)->dcnum);
  102.             ccatchr   (cptr, 13, 1);
  103.             ccat      (cptr, "  $0E: deepCopy   = ");
  104.             ccatdec   (cptr, mDerefUndoPart(hndl)->deepCopy);
  105.             return(true);
  106.             break;
  107.  
  108.         default:
  109.             break;
  110.     }
  111.  
  112.     return(noErr);
  113. }
  114.  
  115.  
  116.  
  117.